<script>
$(function() {
		$( "#ground_order_reserved_date" ).datepicker({
			showOn: "button",
		
		});
		loadSchedule();
	});
	function loadSchedule() {
		ground_id = $('#ground_order_ground_id').val();
		$('#ground_order_schedule').load('<?php echo url_for('@ground_order_load_schedule') ?>'+'?type=schedule&'+$('#filterSearch').serialize(),{
			ground_id: ground_id,
			order_code: '<?php echo $order_code ?>',
		});
	}
</script>
<h1>Thay đổi thông tin đặt sân</h1>
<h3><?php echo isset($message) ? $message : '' ?></h3>
<div id="editForm" class='backend_form'>
  <form id="filterSearch" action="<?php echo url_for('@ground_order_edit?order_code='.$order_code) ?>" method="post">
    <table>
      <?php echo $edit_form ?>
      <tr>
      	<th>Dịch vụ thêm</th>
        <td>
      	<?php
			$temp = array();
			foreach ($old_facility_ids as $old_facility)
				$temp[] = $old_facility;

			foreach ($facilities as $facility)
			{
				
		?>
			<div style='display:block;padding:5px 0;'>
				<div style='float:left'>
					<input type='checkbox' name='ground_order_facility_<?php echo $facility['id'] ?>' id='ground_order_facility_<?php echo $facility['id'] ?>' <?php echo (in_array($facility['id'],$temp))?"checked='checked'":"" ?> /> 
				</div>
				<div style='float:left; padding-top:3px; padding-left:3px; '>
					<label for="ground_order_facility_<?php echo $facility['id'] ?>">
						<?php echo $facility['name'] ?> - <span style="color:#c00;"><?php echo $facility['value'] ?> VNĐ</span>
					</label>
				</div>
				<div style='clear:both'></div>
			</div>
		<?
			}
		?>
        </td>
      </tr> 
        
      <tr><th>
        <input  id="fs" type="submit" value="<?php echo "Save" ?>"/>
      </th></tr>
    </table>
  </form>
</div>